package com.etone.simplesocket;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;


public class Server {
	
	public static int PORT = 9100;
	public static String IP = "127.0.0.1";
	
	private static ServerSocket ss;
	
	public static void service(){
		Socket s;
		InputStream is;
		OutputStream os;
			try {
				BufferedReader br = null;
				ss = new ServerSocket(Server.PORT);
				while (true) {
					s = ss.accept();
					is = s.getInputStream();
					br = new BufferedReader(new InputStreamReader(is));
					
					os = s.getOutputStream();
					os.write(1);
					System.out.println(br.readLine());
				}
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		
	}
	
	public static void main(String a[]){
		Server.service();
	}

}
